package com.atguigu.hbase;

public class Test{
    public static void main(String[] args) {
        Thread thread1 = new Thread();
        Thread thread2 = new Thread();
        thread1.setName("线程1");
        thread2.setName("线程2");
        thread1.start();
        thread2.start();
    }
}

class Number implements Runnable{
    private int number = 1;

    @Override
    public void run() {
        while (number <= 100){
            synchronized (this){
                number++;
                notify();
                try {
                    if (number <= 100){
                        System.out.println(this + "---->" + number);
                        wait();
                    }
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
        }
    }
}